/*
 * Flashlib - QB9 common Flash library
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


package com.qb9.flashlib.tasks
{
	import com.qb9.flashlib.interfaces.IDisposable;
	import com.qb9.flashlib.interfaces.IUpdateable;
	import flash.events.IEventDispatcher;
	import flash.events.Event;

	/**
	 * Interface for all tasks.
	 */
	public interface ITask extends IDisposable, IUpdateable, IEventDispatcher
	{
		/**
		 * Returns whether or not the task is currently in execution.
		 */
		function get running():Boolean;

		/**
		 * Returns the elapsed time, in milliseconds.
		 */
		function get elapsed():uint;

		/**
		 * Start execution of the task.
		 */
		function start():void;
		
		/**
		 * Stop execution of the task.
		 *
		 * Call <code>start()</code> to resume execution.
		 */
		function stop():void;
		
		/**
		 * Clone the task. This method will only be called before the task is started.
		 */
		function clone():ITask;
	}
}
